package Demo02;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x1 = scanner.nextInt();
        int y1 = scanner.nextInt();
        int x2 = scanner.nextInt();
        int y2 = scanner.nextInt();
        int x3 = scanner.nextInt();
        int y3 = scanner.nextInt();
        int x4 = scanner.nextInt();
        int y4 = scanner.nextInt();

        int x11, y11, x22, y22, x33, y33, x44, y44;
        if (x1 <= x3) {
            x11 = x1;
            y11 = y1;
            x22 = x3;
            y22 = y3;
            x33 = x4;
            y33 = x4;
            x44 = x2;
            y44 = y2;
        } else {
            x11 = x3;
            y11 = y3;
            x22 = x1;
            y22 = y1;
            x33 = x2;
            y33 = y2;
            x44 = x4;
            y44 = y4;
        }
        if (x22 >= x11 && x22 <= x44) {
            //x22处于中间
            if (x33 <= x44 && y33 <= y44) {
                //第一种
                System.out.println((x4 - x1) * (y4 - y1));
            } else if (x33 <= x44 && y33 >= y44) {
                //第三种

            }
        } else {

        }

    }
}
